home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000376_fj@iesd.auc.dk_Sat Mar 12 20:52:22 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  2KB

  1. Received: from iesd.auc.dk by cs.umb.edu with SMTP id AA01653
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Sat, 12 Mar 1994 13:53:02 -0500
  3. Received: from loke.iesd.auc.dk (loke.iesd.auc.dk [130.225.48.20]) by iesd.auc.dk (8.6.5/8.6.5) with ESMTP id TAA10353; Sat, 12 Mar 1994 19:52:59 +0100
  4. From: Frank Jensen <fj@iesd.auc.dk>
  5. Received: from localhost (fj@localhost) by loke.iesd.auc.dk (8.6.4/8.6.4) id TAA24474; Sat, 12 Mar 1994 19:52:22 +0100
  6. Date: Sat, 12 Mar 1994 19:52:22 +0100
  7. Message-Id: <199403121852.TAA24474@loke.iesd.auc.dk>
  8. To: tex-k@cs.umb.edu
  9. Subject: Kpathsearch 1.7 -- bug in "db.c"
  10.  
  11.  
  12. In the `kpse_db_search' function, `free' is being called with a
  13. pointer that was never returned by `malloc'.
  14.  
  15. I have included a fixed version below.  (I prefer to always initialize
  16. objects, even if they are guaranteed by the ANSI standard to be
  17. automatically initialized.)
  18.  
  19. /Frank
  20.  
  21. =============
  22. str_list_type
  23. kpse_db_search P3C(const_string, name,  const_string, path_elt,  boolean, all)
  24. {
  25.   static hash_table_type db = { NULL, 0 };
  26.  
  27.   /* Hash up the database if this is the first call.  */
  28.   if (db.size == 0)
  29.     {
  30.       db = hash_create (7603); /* What the heck, sparse is ok.  */
  31.       db_build (&db);
  32.     }
  33.   
  34.   {
  35.     string *p, *db_dirs = hash_lookup (db, name);  /* Look up NAME.  */
  36.     str_list_type ret = str_list_init (); /* Some old compilers ...  */
  37.   
  38.     if (!db_dirs)  /* nothing in the database */
  39.        return ret;
  40.  
  41.     /* For each filename found, see if it matches the path element.  For
  42.        example, if we have ../cx/cmr10.300pk and .../ricoh/cmr10.300pk,
  43.        and the path looks like .../cx, we don't want the ricoh file.  */
  44.     for (p = db_dirs; *p != NULL; p++)
  45.       {
  46.         string db_file = concat (*p, name);
  47.  
  48.         if (match (db_file, path_elt) && kpse_readable_file (db_file))
  49.           {
  50.             str_list_add (&ret, db_file);
  51.             if (!all) break;
  52.           }
  53.         else
  54.           free (db_file);
  55.       }
  56.   
  57.     /* This is just the space for the pointers, not the strings.  */
  58.     free (db_dirs);
  59.  
  60.     return ret;
  61.   }
  62. }